// Copyright 2021 Guoyoko. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "Engine\GameEngine.h"
#include "SWGameEngine.generated.h"


/**
 * specify which GameEngine class to use in Engine ini file:
 * [/Script/Engine.Engine]
 * GameEngine=/Script/SWEditorViewportClient.SWGameEngine
 */
UCLASS()
class SWEDITORVIEWPORTCLIENT_API USWGameEngine : public UGameEngine
{
	GENERATED_BODY()

public:
	/**
	* Creates the viewport widget where the games Slate UI is added to.
	*
	* @param GameViewportClient	The viewport client to use in the game
	* @param MovieCapture			Optional Movie capture implementation for this viewport
	*/
	void CreateGameViewportWidget(UGameViewportClient* GameViewportClient);

	/**
	 * Creates the game viewport
	 *
	 * @param GameViewportClient	The viewport client to use in the game
	 * @param MovieCapture			Optional Movie capture implementation for this viewport
	 */
	void CreateGameViewport(UGameViewportClient* GameViewportClient);

	// UEngine interface
	virtual void Init(class IEngineLoop* InEngineLoop) override;
	virtual void Tick(float DeltaSeconds, bool bIdleMode) override;

protected:

	FSceneViewport* GetGameSceneViewport(UGameViewportClient* ViewportClient) const;

private:
	/** Last time the logs have been flushed. */
	double LastTimeLogsFlushed;
};

